package com.lzy.cloud.order.service.impl;

import com.lzy.cloud.order.dtos.OrderRuleDto;
import com.lzy.cloud.order.entity.OrderRefundPic;
import com.lzy.cloud.order.entity.OrderRule;
import com.lzy.cloud.order.mapper.OrderRuleMapperExt;
import com.lzy.cloud.order.service.OrderRuleService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description:订单退订规则快照信息
 * @author: liyun
 * @create: 2018-07-06 16:26
 */
@Service
public class OrderRuleServiceImpl implements OrderRuleService {
    @Autowired
    private OrderRuleMapperExt orderRuleMapperExt;

    @Override
    public OrderRuleDto queryByOrderId(String orderId) {
        return orderRuleMapperExt.queryByOrderId(orderId);
    }

    @Override
    public Long create(OrderRuleDto orderRuleDto) {
        OrderRule orderRule = DozerUtils.map(orderRuleDto, OrderRule.class);
        return orderRuleMapperExt.insertSelective(orderRule)>0 ? orderRule.getId() : 0;
    }
}
